V1.0 - Tidied up code and comments - final version that will be submitted.
